package com.zuihai.app.mvp.ui.holder;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageView;

import com.blankj.utilcode.util.LogUtils;
import com.zuihai.app.R;
import com.zuihai.app.mvp.model.entity.BackgroundResult;
import com.zuihai.app.mvp.ui.utils.MyUtils;

/**
 * Created by Administrator on 2017/5/12 0012.
 */

public class BackgroundHolder extends BaseViewHolderWraper<BackgroundResult> {

    private Context mContext;
    public BackgroundHolder(View itemView, Context mContext) {
        super(itemView);
        this.mContext=mContext;
    }


    @Override
    public void fillData(BackgroundResult item, int position) {
        super.fillData(item, position);
        WindowManager wm = (WindowManager) mContext
                .getSystemService(Context.WINDOW_SERVICE);
        int width = wm.getDefaultDisplay().getWidth();
        ImageView imageView=getView(R.id.iv_cover);
        ViewGroup.LayoutParams params = imageView.getLayoutParams();
        params.height = width*   9/16;
        LogUtils.e("width params : "+width);
        LogUtils.e("height params : "+params.height);
        //params.height = (int) (itemView.getMeasuredWidth() * 0.8);
        imageView.setLayoutParams(params);
        MyUtils.enlargeGlide(mApplication,item.getPictureUrl(),imageView);



    }

}
